﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/TakeoutExpress.Standard.Master" AutoEventWireup="true" CodeBehind="SiteEditor.aspx.cs" Inherits="TakeoutExpress2008.Web.MVC.Admin.SiteEditor" Title="Untitled Page" EnableEventValidation="false" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphHeader" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphLeftContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphMainContent" runat="server">
    <div class="SubHeader">Sites</div><div class="SubHeaderAdmin">
   
    <asp:LinkButton runat="server" CausesValidation="false" Text="Add New Site" 
        ID="lnkAddNewSite" onclick="lnkAddNewSite_Click">Add New Site</asp:LinkButton>
    <cc1:ModalPopupExtender runat="server" ID="lnkAddNewSite_ModalPopupControlExtender"
     PopupControlID="pnlAddSitePopup" Drag="true" CancelControlID="Button1"  TargetControlID="lnkAddNewSite">
      </cc1:ModalPopupExtender>
    
   </div>
    <div class="Normal">
        <asp:UpdatePanel runat="server" ID="pnlUpdategvSites" UpdateMode="Always">
      <ContentTemplate>
        <asp:GridView ID="gvSites" runat="server"  
            AutoGenerateColumns="False" CellPadding="4" 
            DataKeyNames="SiteID"  
            ForeColor="#333333" GridLines="None" Width="100%">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
            
                <asp:TemplateField HeaderText="SiteName" SortExpression="SiteName">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtUpdatedSiteName" runat="server" Text='<%# Bind("SiteName") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("SiteName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                        <asp:LinkButton ID="lnkUpdate" runat="server" CommandArgument='<%# Container.DisplayIndex %>' CausesValidation="True" 
                            CommandName="Update" Text="Update"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="lnkCancel" runat="server" CommandArgument='<%# Container.DisplayIndex %>' CausesValidation="False" 
                            CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkEdit" runat="server" CommandArgument='<%# Container.DisplayIndex %>' CausesValidation="False" 
                            CommandName="Edit" Text="Edit"></asp:LinkButton>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Right" />
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkDelete" runat="server" CausesValidation="False" 
                            CommandName="Delete" Text="Delete" CommandArgument='<%# Container.DisplayIndex %>'></asp:LinkButton>
                    <cc1:ConfirmButtonExtender runat="server" ConfirmText="Are you sure you want to delete this record?" ID="lnkDelete_Confirm" TargetControlID="lnkDelete"></cc1:ConfirmButtonExtender>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Right" />
                </asp:TemplateField>
            </Columns>
            <PagerStyle BackColor="#284775" BorderStyle="None" ForeColor="White" 
                HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <asp:LinqDataSource ID="LinqDataSource_TakeoutExpress" runat="server" 
            ContextTypeName="TakeoutExpress.Support.Linq.TakeoutExpress2008DataContext" 
            Select="new (SiteID, SiteName)" TableName="Sites" EnableDelete="True" 
            EnableUpdate="True">
        </asp:LinqDataSource>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="gvSites" />
            <asp:AsyncPostBackTrigger ControlID="btnAdd" />
        </Triggers>
        </asp:UpdatePanel>
        <asp:UpdateProgress AssociatedUpdatePanelID="pnlUpdategvSites" ID="upGvSites" runat="server"><ProgressTemplate>UPDATING SITES GRID</ProgressTemplate></asp:UpdateProgress>
    </div>
    
    <asp:Panel runat="server" ID="pnlAddSitePopup" Width="400px" Height="300px" CssClass="PopupControl">
        <div class="PopupControl">Site Name: <asp:TextBox runat="server" ID="txtNewSiteName"></asp:TextBox>
            <br /><br />
            <div style="text-align:right;"><asp:Button runat="server" CssClass="PopupButton" 
                    Text="Add" ID="btnAdd" onclick="Unnamed1_Click" /><asp:Button ID="Button1" runat="server" CssClass="PopupButton" Text="Cancel" /></div>
        </div>
           
        
    </asp:Panel>
    
</asp:Content>
